package com.yunshipei.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.yunshipei.base.BaseActivity;
import com.yunshipei.enterplorer.R;
import com.yunshipei.ui.fragment.AboutDetailFragment;

public class AboutDetailActivity extends BaseActivity {

    private static final String EXTRA_NAME = "name";
    private static final String EXTRA_URL = "url";

    public static Intent getHandlerIntent(Context context, String name, String url) {
        Intent intent = new Intent(context, AboutDetailActivity.class);
        intent.putExtra(EXTRA_NAME, name);
        intent.putExtra(EXTRA_URL, url);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_detail);
        String url = getIntent().getStringExtra(EXTRA_URL);
        String name = getIntent().getStringExtra(EXTRA_NAME);
        Fragment fragment = getSupportFragmentManager().findFragmentByTag(AboutDetailFragment.class.getName());
        if (fragment == null) {
            fragment = AboutDetailFragment.newInstance(url, name);
            getSupportFragmentManager().beginTransaction().add(R.id.fl_about_detail_content, fragment, fragment.getClass().getName()).commit();
        }
    }
}
